package com.genia.toolbox.basics.tools.crypto;

import java.io.IOException;

/**
 *
 * 	This tools is used to encrypt a string with an encryption algorithm.
 *	This class is a part of a design pattern template.
 *
 */
public abstract class Encrypter {

	/**
	 * This method is used to be called by the subClass to encrypt your String
	 * @param str
	 * 			String to be encrypt
	 * @return
	 * 			Return the String encrypted
	 * @throws IOException
	 */
	public String	encrypt(String str)throws IOException{

		return encryptAbstract(str);
	}

	/**
	 * This is an abstract method.
	 * @param encode
	 * 			String to be encrypted
	 * @return
	 * 			String encrypted
	 * @throws IOException
	 */
	public  abstract String	encryptAbstract(String encode) throws IOException;

	/**
	 * This method is used to be called by the subClass to decipher your String
	 * @param str
	 * 			String to be decipher
	 * @return
	 * 			Return the String deciphered
	 * @throws IOException
	 */
	public String	decrypt(String str) throws IOException {

		return decryptAbstract(str);
	}

	/**
	 * This is an abstract method.
	 * @param decode
	 * 			String to be decipher
	 * @return
	 * 			String deciphered
	 * @throws IOException
	 */
	public abstract String	decryptAbstract(String decode) throws IOException;
}
